	//제목
	function clsClubBoardWrite_Title(){
		this._HTMLDom = null;
		this._init();	
		this._ERRMSG = {
			"_NOVALUE": "제목을 입력해 주십시요."
		}
		this.errMsg = null;
	}
	
	clsClubBoardWrite_Title.prototype= {
		_init: function(){
			var $layer = $("section#club_board_write>section form div ul li:eq(0) input:text:eq(0)");
			this._HTMLDom = {
				"$layer": $layer
			}	
		}
		, getValue: function(){
			return this._HTMLDom["$layer"].val();
		}
		, isValid: function(){
			if(this.getValue().trim() == ""){
				this.errMsg = this._ERRMSG["_NOVALUE"];
				return false;
			}
			
			return true;
		}
		, getError: function(){
			return this.errMsg;
		}
	}
	
	//공지유무
	function clsClubBoardWrite_Notice(){
		this._HTMLDom = null;
		this._init();	
		this._ERRMSG = {
			
		}
		this.errMsg = null;
	}
	
	clsClubBoardWrite_Notice.prototype= {
		_init: function(){
			var $layer = $("section#club_board_write>section form div ul li:eq(0) div.club_bdW input:checkbox");
			this._HTMLDom = {
				"$layer": $layer
			}	
			$layer.prop("checked",false).checkboxradio("refresh");
		}
		, getValue: function(){
			return this._HTMLDom["$layer"].prop("checked");
		}
		, isValid: function(){
			return true;
		}
		, getError: function(){
			return this.errMsg;
		}
	}
	
	//첨부사진
	function clsClubBoardWrite_File(){
		this._HTMLDom = null;
		this._init();	
		this._ERRMSG = {
			
		}
		this.errMsg = null;
	}
	
	clsClubBoardWrite_File.prototype= {
		_init: function(){
			var $layer = $();
			this._HTMLDom = {
				"$layer": $layer
			}	
			$layer.val("");			
		}
		, getValue: function(){
			return "";
		}
		, isValid: function(){
			return true;
		}
		, getError: function(){
			return this.errMsg;
		}
	}
	
	//내용
	function clsClubBoardWrite_Contents(){
		this._HTMLDom = null;
		this._init();	
		this._ERRMSG = {
			"_NOVALUE": "내용을 입력해 주십시요."
			, "_MAXLEN": "한글기준 500자 이내로 작성하여 주십시요."
		}
		this.errMsg = null;
	}
	
	clsClubBoardWrite_Contents.prototype= {
		_init: function(){
			var $layer = $("section#club_board_write>section form div ul li:eq(1) textarea");
			this._HTMLDom = {
				"$layer": $layer
			}	
			$layer.val("");			
		}
		, getValue: function(){
			return this._HTMLDom["$layer"].val();
		}
		, isValid: function(){
			if(this.getValue().trim() == ""){
				this.errMsg = this._ERRMSG["_NOVALUE"];
				return false;
			}else if(_util.getByteLen(this.getValue()) > 500){
				this.errMsg = this._ERRMSG["_MAXLEN"];
				return false;
			}
			
			return true;
		}
		, getError: function(){
			return this.errMsg;
		}
	}
	
	//공개설정
	function clsClubBoardWrite_Open(){
		this._HTMLDom = null;
		this._init();	
		this._ERRMSG = {
			
		}
		this.errMsg = null;
	}
	
	clsClubBoardWrite_Open.prototype= {
		_init: function(){
			var $layer = $("section#club_board_write>section form div ul li:eq(2) input:radio");
			this._HTMLDom = {
				"$layer": $layer
			}	
			$layer.eq(0).prop("checked",true).checkboxradio("refresh");
		}
		, getValue: function(){
			var $layer = this._HTMLDom["$layer"];
			return $layer.index($layer.filter(":checked"));
		}
		, isValid: function(){
			return true;
		}
		, getError: function(){
			return this.errMsg;
		}
	}
	
	//데이터연동		
	function clsComm_ClubBoardWrite(){
		this._init();
	}	
	clsComm_ClubBoardWrite.prototype = {
		_init: function(){
		
		}
//------------------------ 글등록/수정------------------------//		

		, InsertBoard: function(arg){			
			var thisClass = this;
			
			var szClubSeq = arg["동호회키"];
			var szBoardSeq = arg["게시판키"];
			var szTitle = arg["제목"].replace(/"/g, "\\\"");
			var szContent = arg["내용"].replace(/\n/g,"").replace(/"/g, "\\\"");
			var szViewType = arg["공개유무"];
			var szNotice = arg["공지유무"];
			var szFile = arg["파일리스트"]
			
			var objJson = new MJson();
        	var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
        	objJson.putPub("sid", "CB001");
        	objJson.putPub("servicename","regClubBoard");   
        					
        	objJson.putParameter("board_type", "D");
        	objJson.putParameter("club_seq", szClubSeq);
        	objJson.putParameter("board_seq", szBoardSeq);
        	objJson.putParameter("title", szTitle);
        	objJson.putParameter("content", szContent);
        	objJson.putParameter("view_type", szViewType);//A : 전체 / C: 동호회
        	objJson.putParameter("notice_yn", szNotice);
        	objJson.putParameter("file_list", szFile);
        	objJson.putParameter("file_list_attach", "");
        
			cm.requestGet(objJson.getJsonString(), function(ret){
				
				// callback and mapping
				var resData = {
					"응답코드": (ret["msp"]["contents"]["serviceResult"] == "00000"?true:false)
					, "메세지": _util.getResultMsg(ret)
				}
				
				$(thisClass).trigger("evtFinishClubSubmit", [resData]);
				
			}, function($err) {
				alert($err);
			});		
		}
//------------------------ 글등록------------------------//		
	}
	
	//컨트롤파일
	function ClubBoardWrite(){				
		this.objComm = null;
		this.club_seq = null;	
		this.club_info = null;		
		
		this.objClubBoardWrite_View = null;		
	};
	
	ClubBoardWrite.prototype = {
	    onPageShow : function() {	    
	    	$("a").attr("href", "").attr("data-rel", "");      
	    	this._init();	  
	    }
	    , _beforeStart: function(){
	    	var 	thisClass = this;
	    	
	    	this._permitStart = {
				"동호회정보": false	
			}
			
	  		// 서버 메시지맵
			$.ajax({
				url: "../js/src/club/club_inc.js"
				, type: "get"
				, dataType: "script"
				, async: false
				, success: function(ret, sta){
					//alert("success!!");					
				}
				, error:function(e){
					alert("error=" + e);
				}	
			});
			
			_cb.getClubInfoData({
				"콜백": function(ret, l){
					thisClass._permitStart["동호회정보"] = true;	
				}
			});
			
			_util.executeThread(function(){
				for(key in thisClass._permitStart){		
					if(!thisClass._permitStart[key]) return false;
				}
				return (true);
			}, function(){			
				thisClass._start();
			});
	    }
	    , _init: function(){	    	    	
	    		    	
	    	this.objComm = new clsComm_ClubBoardWrite();
			this.objClubBoardWrite_Title = new clsClubBoardWrite_Title();
			this.objClubBoardWrite_Notice = new clsClubBoardWrite_Notice();
			this.objClubBoardWrite_File = new clsClubBoardWrite_File();
			this.objClubBoardWrite_Contents = new clsClubBoardWrite_Contents();
			this.objClubBoardWrite_Open = new clsClubBoardWrite_Open();
			
	      this.getParam();
	      
	      this._beforeStart();
	    	
	    	this._role();
	       
	      	this._bind();	 
	      	this._eventFinish();     	
	    }
	    , _start: function(){	    	
	    	//동호회기본정보
	    	this.club_info = _cb.getClubInfo();	    	
	    }
	    , _eventFinish: function(){
	    	var thisClass = this;
	    	
	    	//게시글 등록 완료이벤트
			$(this.objComm).bind("evtFinishClubSubmit", function(event, resData){				
				alert(resData["메세지"]);				
				if(resData["응답코드"]){	
					_gf.CLUB_DATA = {
						"동호회키": thisClass.club_seq	
					}
					$.mobile.changePage("club_board.html","slide",true);	
				}
				thisClass.spinEnd();				
			});
	    }
		 , _bind: function(){
		 	var thisClass = this;		 	
			
			//등록
			$("section#club_board_write>section form div.btn_area02 div div:eq(0) a").click(function(event){
				event.preventDefault();
								
				if(!thisClass.objClubBoardWrite_Title.isValid()){
					alert(thisClass.objClubBoardWrite_Title.getError());
					return;
				}else if(!thisClass.objClubBoardWrite_Notice.isValid()){
					alert(thisClass.objClubBoardWrite_Notice.getError());
					return;
				}else if(!thisClass.objClubBoardWrite_File.isValid()){
					alert(thisClass.objClubBoardWrite_File.getError());
					return;
				}else if(!thisClass.objClubBoardWrite_Contents.isValid()){
					alert(thisClass.objClubBoardWrite_Contents.getError());
					return;
				}else if(!thisClass.objClubBoardWrite_Open.isValid()){
					alert(thisClass.objClubBoardWrite_Open.getError());
					return;
				}
								
				var submitData = {
					"동호회키": thisClass.club_seq
					, "제목": thisClass.objClubBoardWrite_Title.getValue()
					, "공지유무": (thisClass.objClubBoardWrite_Notice.getValue()?"Y":"N")
					, "파일리스트": thisClass.objClubBoardWrite_File.getValue()
					, "내용": thisClass.objClubBoardWrite_Contents.getValue()
					, "공개유무": (thisClass.objClubBoardWrite_Open.getValue()?"C":"A")
				}
				
				thisClass.spinStart();
				thisClass.objComm.InsertBoard(submitData);
			});
			
			//취소
			$("section#club_board_write>section form div.btn_area02 div div:eq(1) a").click(function(event){
				event.preventDefault();
				alert("취소");
			});
			
		 	//메뉴
		 	$("section#club_board_write nav ul li a:eq(0)").click(function(event){
		 		event.preventDefault();
		 		thisClass.goNavi();
		 	});
		 	
		 	//알림
		 	$("section#club_board_write nav ul li:eq(1)").click(function(event){
		 		event.preventDefault();
		 		$.mobile.changePage("../inc/info_booking.html","slide",true);	
		 	});
		 	
		 	//이전
		 	$("section#club_board_write header div.top_title_B div.top_right a.btn11").click(function(event){
		 		event.preventDefault();
		 		_gf.CLUB_DATA = {
					"동호회키": thisClass.club_seq	
				}
		 		$.mobile.changePage("club_board.html","slide",true);	
		 	});
		 }
		 , getParam: function(){
	    	this.club_seq = _gf.CLUB_DATA["동호회키"];
	    }
	    , _role: function(){
	    		
	   }
		, goNavi: function(){			
			$.mobile.changePage("../inc/navi.html","slide",true);
		}
	    , spinStart: function(){		
			$.mobile.showPageLoadingMsg();			
		}
		, spinEnd: function(){			
	 		$.mobile.hidePageLoadingMsg();				
		}
	}	